<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>完成付款</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="__INDEX__/css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="__INDEX__/css/style.css" />
		<link rel="stylesheet" href="__INDEX__/css/iconfont.css" />
		<link rel="stylesheet" href="__INDEX__/css/mall.css" />
	</head>
<body>
	<div class="mui-content">
		<div class="fukc_top">
			<p style="margin-right: 3%; text-align: right; display: none;" id='gz'>
	    		<a style="font-size: 14px;color: #1AAD19;" href="https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzIyNDE2NjQ0OA==#wechat_webview_type=1&wechat_redirect"> 
		    		<span class="mui-icon iconfont icon-shoucang" style="font-size: 1.3rem; line-height: 2rem;"></span>
					<span class="mui-tab-label">关注</span> 
	    		</a>
	    	</p>
			<div class="iconfont icon-weixin2" style="display: none;"></div>
			<div class="iconfont icon-zhifubao1" style="display: none;"></div>
			<p id='is_success'>支付成功</p>
			<div class="fukc_pribox">¥<em id='pay_money'></em></div>
		</div>
		<div class="fukc_djh clearfix">
			<div class="clearfix zengsong" style="display: none;">
				<div class="left"><span class="shopinf_glj">赠送鼓励金</span></div>
				<div class="right"><em id='s_pay_score'></em></div>
			</div>
			<div class="clearfix dixian" style="display: none;">
				<div class="left"><span class="shopinf_glj">鼓励金抵扣</span></div>
				<div class="right"><em id='j_pay_score'></em><em>元</em></div>
			</div>
		</div>
		<div class="fukc_xq clearfix">
			<div class="left">付款详情</div>
			<div class="right">
				<p class="clearfix is_jif">
					<Span class="pleft" id='pay_model'></Span>
					<span class="pright"><em id='pay_money2'></em>元</span>
				</p>
				<p class="clearfix">
					<Span class="pleft">订单编号</Span>
					<span class="pright"><em id='sn'></em></span>
				</p>
			</div>
		</div>
		<div class="qitsj_lisbox">
			<div class="fukc_djh fukc_gljye clearfix">
				<div class="left"><span class="fuk_gljye">鼓励金余额</span></div>
				<div class="right"><em id='user_score'></em>元</div>
			</div>
			<div class="bt bt2"><img src="__PUBLIC__/static/index/images/payment_ct.jpg"></div>
			<ul class="index_sjlist" id='item_ul'>
				<!--<li class="clearfix">
					<div class="tjsj_img"><img src="../images/bgtu.jpg"></div>
					<div class="tjsj_info">
						<div class="tjsj_nam">
							<div class="name">英豪大酒店</div>
							<div class="iconfont icon-new"></div>
						</div>
						<div class="tjsj_jif">鼓励金最高可抵<em>100%</em></div>
						<div class="tjsj_dzbox clearfix">
							<div class="tjsj_dz">北湖区，南岭大道辅路</div>
							<div class="tjsj_jul">3.295km</div>
						</div>
					</div>
				</li>-->
			</ul>
		</div>
	</div>
	{include file="public/bottom" /}
</body>
{include file="public/footer" /}
<script src="__PUBLIC__/static/js/mui.min.js"></script>
<script src="__PUBLIC__/static/js/assist.js"></script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.2&key=eef7f290ac06bdf05b246cebc8cb2fb6&callback=my_getAddress"></script>
<script type="text/javascript">
	var index = layer.load(0, {shade: false,time: 1 * 1000});
	mui.init();
	var aniShow = "pop-in";
	//页面跳转
	mui('#footer-list').on('tap', 'a', function() {
		var id = this.getAttribute('href');
		var href = this.href;
		mui.openWindow({
			id: id,
			url: this.href,
			show: {
				aniShow: aniShow
			},
			waiting: {
				autoShow: false
			}
		});
	});
</script>
<script>
var index = layer.load(0, {shade: false,time: 1.5 * 1000});
$(".layui-layer-loading").css("left", "50%");
</script>
<script type="text/javascript">

get_data();
    function get_data(){
    	
    	window.setTimeout(function(){
    		$.ajax({
				type: "post",
				data: {
					order_sn	: getUrlParam('order_sn')
				},
				url: "{:url('index/pay/pay_success')}",
				success: function(data) {
					//付款信息
					var pay_log_info = data.pay_info.pay_log_info;
					if(pay_log_info) {
						
						if(pay_log_info['state'] == 2){
							$('#is_success').text('付款成功');
						}else{
							$('#is_success').text('付款成功');
						}
						//付款方式
						if(pay_log_info['pay_type'] == 2) {
							$('.icon-weixin2').show();
							$('#pay_model').text('微信支付');
						} else {
							$('.icon-zhifubao1').show();
							$('#pay_model').text('支付宝支付');
						}
						
						if(data.pay_info.user_core){
							//用户鼓励金余额
							$('#user_score').text(data.pay_info.user_core['score']);
							if(data.pay_info.user_core['is_atten'] == 0){
								$('#gz').show();
							}
							
						}else{
							$('#user_score').text(0);
						}
						
						
						//付款金额
						$('#pay_money').text(pay_log_info['origin_price']);
						$('#pay_money2').text(pay_log_info['balance']);
						//订单号
						$('#sn').text(pay_log_info['order_sn']);
						//赠送鼓励金
						$('#s_pay_score').text(pay_log_info['member_score'])
						//抵扣鼓励金
						$('#j_pay_score').text(pay_log_info['agent_score'])

						if(pay_log_info['member_score'] > 0) {
							$('.zengsong').show();
						}
						if(pay_log_info['agent_score'] > 0) {
							$('.dixian').show();
						}
					}

					//附件商户
					var list = data.pay_info.agent_list;
					var html = "";
					if(list) {
						for(var o in list) {
							var agent = list[o];
							var juli = agent.juli;
							var diz = agent.address;
							var begin_time = ''
							var end_time = '';
							var dk = 0;
							if(agent.is_score == 1) {
								dk = agent.ad_score;
							}
							var action = agent['action'];
							if(action == null) {
								action = "暂无";
							}
							if(juli < 1000) {
								juli = "<1k";
							}
							if(diz && diz.length > 0) {
								diz = agent.address;
							} else {
								diz = '暂无';
							}
							if(agent.start_time && agent.start_time.length > 0) {
								begin_time = agent.start_time.substr(0, agent.start_time.length - 3);
							} else {
								begin_time = '00:00';
							}
							if(agent.end_time && agent.end_time.length > 0) {
								end_time = agent.end_time.substr(0, agent.end_time.length - 3);;
							} else {
								end_time = '00:00';
							}
							var logo = agent.logo;
							if(!logo) {
								logo = "__PUBLIC__/static/index/images/noimage.jpg";
							}
							html += "<li>"
									  +"<a href='/index/index/shop_info?agent_id="+agent.id+"' class='clearfix'>"
									  +"<div class='index_sjimg'><img src='"+logo+"'></div>"
									  +"<div class='index_sjinfo'>"
									  +"<div class='index_spname'>"+agent.agent_name+"</div>"
									  +"<div class='index_spstyle clearfix'>"
									  +"<span>"+diz+"</span>"
									  +"</div>"
									  +"<div class='index_dkbox clearfix'>"
									  +"<em class='index_dkbl'>鼓励金抵扣</em>"
									  +"<em class='index_dkbr'>"+dk+"%</em>"
									  +"</div>"
									  +"</div></a>"
									  +"<div class='shopzxhd'><span style='color:#333;font-weight:bold;'>最新活动&nbsp;:&nbsp;</span><span style='margin-left:5px'>"+action+"</span></div>"
									  +"</li>";
						}
						$("#item_ul").html(html);
					} else {
						$("#item_ul").html("<li>附近无商铺<li>");
					}
				}
			});
    	},1000);
    }

</script>